HTTP Chat Sample
Purpose
The Http Chat sample shows how to use polled events to create an HTTP based chat program.
The clients poll every few seconds for new messages and the server distributes the messages to the appropriate client(s).
Two different Session Manager and Event repotory pairs can be used in this sample:
- InMemorySessionManager and InMemoryEventRepository - keeps all required data in memory.
- OlympiaSessionManager and OlympiaEventRepository - uses Olympia server to store the necessary data. Requires Olympia server to be running on the same host as server.
Testing
To test this sample properly, you need to run at least three clients:
- send a message to all clients
- send a message to selected clients
- close a client via the server
- logout a user and see the effect on the server and other clients
- issue shutdown warning from server
- deactivate server and try to send messages
JavaScript client
Open http://localhost:8099/js/ when the http chat server is running.
Examine page source to see EventReceiver usage example.